<template>
  <div class="container">
    <view-box ref="viewBox" body-padding-top="46px" body-padding-bottom="53px">
      <x-header class="my-header" >订单列表</x-header>
      <group>
        <form-preview :header-label="$t('服务对象')" :header-value="orderData.patient_name" :body-items="list"></form-preview>
      </group>
      <coids_eval v-for="item in coidList" :orderData="item"></coids_eval>
    </view-box>
  </div>
</template>

<script>
  import {FormPreview,XButton,Toast,Group,Radio,Datetime,XHeader,ViewBox} from 'vux'
  import coids_eval from '@/components/order_process/coids_eval'
  export default {
    data(){
      return{
        oid:'',
        orderData:'',
        list:[],
        coidList:[],
        orders:[],
        buttons: [],
      }
    },
    mounted(){
      this.orderData=this.$route.query
      this.initdata()
      this.getOrderDetails()
    },
    methods:{
      initdata(){
        let orderdata=this.orderData
        let type,loc,name,time,date
        type={label:'服务名称', value:orderdata.service_name}
        loc={label:'病患地址', value:orderdata.loc}
        name={label:'订单号', value:orderdata.oid}
        time={label:'订单次数', value:orderdata.time}
        let datetime =orderdata.datetime.split('.')
        date={label:'下单时间', value:datetime[0]}
        this.list.push(type);
        this.list.push(name);
        this.list.push(time);
        this.list.push(date)
        this.list.push(loc);
      },
      //获取父订单的子订单
      getOrderDetails(){
        let data={
          order_type:1,
          user_type:1
        }
        this.Ajax('post','/Order/order/detail/oid/'+this.orderData.oid,data,(res)=>{
          this.coidList=res.dataList
        })
      },

    },
    components:{
      FormPreview,XButton,Toast,Group,Radio,Datetime,XHeader,ViewBox,coids_eval
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .my-header {
    background-color: rgb(255, 104, 140);
    position: fixed;
    height: 46px;
    left: 0;
    top: 0;
    width: 100%;
    z-index: 100;
  }
</style>
